package com.ssy.lingxi.purchase.api.dto.request;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 需求计划 - 新增
 * @author fhj
 * @date 2021/03/01
 * @version 2.0.0
 */
@Data
public class AddNeedPlanRequest {

    @NotNull(message = "需求计划开始周期不能为空")
    @ApiModelProperty(value = "需求计划开始周期")
    private Long startTime;

    @NotNull(message = "需求计划结束周期不能为空")
    @ApiModelProperty(value = "需求计划结束周期")
    private Long endTime;

    @NotBlank(message = "需求计划摘要不能为空")
    @ApiModelProperty(value = "需求计划摘要")
    private String summary;

    //@NotNull(message = "添加方式不能为空")
    @ApiModelProperty(value = "添加方式：1.选择货品生产；2.导入计划采购物料；")
    private Integer addType;

    @Valid
    @NotEmpty(message = "需求计划明细不能为空")
    @ApiModelProperty(value = "需求计划明细")
    private List<NeedPlanDetailRequest> details;

    @Data
    public static class NeedPlanDetailRequest {

        //@NotNull(message = "物料ID不能为空")
        @ApiModelProperty(value = "物料ID")
        private Long productId;

        @NotBlank(message = "物料编号不能为空")
        @ApiModelProperty(value = "物料编号")
        private String number;

        @NotBlank(message = "物料名称不能为空")
        @ApiModelProperty(value = "物料名称")
        private String name;

        @NotBlank(message = "规格型号不能为空")
        @ApiModelProperty(value = "规格型号")
        private String model;

        @NotBlank(message = "品类不能为空")
        @ApiModelProperty(value = "品类")
        private String category;

        @ApiModelProperty(value = "品牌")
        private String brand;

        @NotBlank(message = "单位不能为空")
        @ApiModelProperty(value = "单位")
        private String unit;

        @NotNull(message = "成本价不能为空")
        @ApiModelProperty(value = "成本价")
        private Double costPrice;

        @NotNull(message = "需求数量不能为空")
        @ApiModelProperty(value = "需求数量")
        private Double needCount;

        @NotNull(message = "需求金额不能为空")
        @ApiModelProperty(value = "需求金额")
        private Double needPrice;

        @NotNull(message = "到货日期不能为空")
        @ApiModelProperty(value = "到货日期")
        private Long arriveTime;

        /**
         * 物料组
         */
        private String goodsGroup;

    }
}
